
import * as constant from '../../constant'

const initState={
    email:'',
    username:'',
    password:'',
    errors:null
}

const userReduer = (state=initState,action)=>{

    switch (action.type) {
        case constant.USER_REGIST_FIELD:
            const key  = action.key
            const value  = action.value
            return {...state,[key]:value}
        case constant.USER_REGIST_RESULT:
           const result  =  action.result
           return {...state,errors:result} // errors:{message:'',errors:xxx}
        case "SUBMIT":
            //注册
            break;
    
        default:
            break;
    }

    return state
}

export default userReduer